var orderCode = getQueryString("code");

var app = angular.module("myApp",["globalApp"]);
app.controller("myCtrl",function($scope,$http){
	var params={
		code : orderCode
	}
	params = $.param(params);
	//商品信息
	$http({
	    method : "post",
	    dataType: "json",
		withCredentials: true,	//跨域名请求。XHR：XMLHttpRequest (XHR) ，基于XML技术的Http请求
		crossDomain: true,
		headers:{'Content-Type': 'application/x-www-form-urlencoded'},
	    async:true,
	    data:params,
	    url : host + "/terminal/orderItem/details"
	}).success(function(response){
		console.log(response);
		if(response.code == 2000){
			$scope.arr = response.data.orderItem;
			console.log(response.data.orderItem);
		}
	})
	//物流信息
	$http({
	    method : "post",
	    dataType: "json",
		withCredentials: true,	//跨域名请求。XHR：XMLHttpRequest (XHR) ，基于XML技术的Http请求
		crossDomain: true,
		headers:{'Content-Type': 'application/x-www-form-urlencoded'},
	    async:true,
	    data:params,
	    url : host + "/terminal/orderItem/shipping"
	}).success(function(response){
		console.log(response);
		if(response.code == 2000){
			$scope.arr1 = response.data.shippingInfo;
			console.log($scope.arr1);
		}
	})
	
})

//自定义过滤器
app.filter("getValue",function(){
	return function(x){
		var value = "";
		for(var i=0; i<10; i++){
			value = value + x.charAt(i);
		}
		return value;
	}
})

app.directive('repeatFinish',function(){
    return {
        link: function(scope,element,attr){
            console.log(scope.$index)
            if(scope.$last == true){
                addClass();
            }
        }
    }
})

//加样式
function addClass(){
	$(".track-list li").eq(-1).addClass("first");
}

